<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>测试登录、注册</title>
  <script src="/jquery.js" /></script>
  <script type="text/javascript">
  $(function(){
    $('#login').on('click',()=>{
      $.ajax({
        url: 'http://localhost:8080/login',
        type: 'POST',
        data: {username: $('#name').val(),password:$('#pass').val()}
      })
      .done(function(res) {
        alert(res);
      })
      .fail(function(err) {
        alert(err);
      });
    });
    $('#reg').on('click',()=>{
      $.ajax({
        url: 'http://localhost:8080/reg',
        type: 'get',
        data: {username: $('#name').val(),password:$('#pass').val()}
      })
      .done(function(res) {
        alert(res);
      })
      .fail(function(err) {
        alert(err);
      });
    });
  });
  </script>
</head>
<body>
  用户名：<input type="text" name="username" id='name'/><br>
  密码：<input type="text" name="password" id='pass'/><br>
  <input type="button" value="登录" id = 'login'>
  <input type="button" value="注册" id = 'reg'>
</body>
</html>
